package com.cqjtu.graduation.service.impl;

import com.cqjtu.graduation.dao.OrderDAO;
import com.cqjtu.graduation.entity.FoodTypeListDO;
import com.cqjtu.graduation.entity.OrderDO;
import com.cqjtu.graduation.service.OrderDOService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderDOServiceImpl implements OrderDOService {
    @Autowired
    private OrderDAO orderDAO;
    @Override
    public void addOrderDO(OrderDO orderDO) {
        orderDAO.saveOrderDO(orderDO);
    }

    @Override
    public List<OrderDO> listOrderDONoPaid(OrderDO orderDO) {
        return orderDAO.listOrderDONoPaid(orderDO);
    }

    @Override
    public Long conuntNoPaidOrderByCondition(OrderDO orderDO) {
        return orderDAO.countNoPaidOrderByCondition(orderDO);
    }

    @Override
    public void payOffOrder(OrderDO orderDO) {
        orderDAO.updateOrderState(orderDO);
    }

    @Override
    public OrderDO getOrderById(OrderDO orderDO) {
        return orderDAO.getByOrderId(orderDO);
    }
    @Override
    public List<OrderDO> findOrderFoodStatus() {
        List<OrderDO> doList= orderDAO.findOrderFoodStatus();
        System.out.println(doList);
        return doList;
    }

    @Override
    public List<OrderDO> findTableNumber() {
        List<OrderDO> doList = orderDAO.findTableNumber();
        return doList;
    }

    @Override
    public List<FoodTypeListDO> findFoodType(Integer orderId) {
        List<FoodTypeListDO> foodTypeListDOS = orderDAO.findFoodType(orderId);
        return foodTypeListDOS;
    }
}
